var links=top.location.href.substring(7).split("/");
var basePath="http://"+links[0]+"/"+links[1]+"/";


$(document).ready(init_comment);
function init_comment(){
	$(".comment_scroll_con").each(function(){
		var $this=$(this);
		var answerId=$this.attr("answerId");
		$.post(basePath+"GetAnswerCommentServlet",{answerId:answerId},function(data,status){
			var json=eval("(" + data + ")");
			var list = json.list;
			var html="";
			for(var i=0;i<list.length;i++){
				var com=list[i];
				html+="<dl id='answer_comment_"+com.commentId+"'><dt><a href='javascript:void(0);' target='_blanl'><img alt='"+com.userNickName+"' src='"+basePath+"userIcons/"+com.userIcon+"' style='width:30px; height:30px;' username='"+com.userNickName+"' /></a></dt>";
				html+="<dd class='comment_content'><em><a class='user_name' href='javascript:void(0);' target='_blanlk'>"+com.userNickName+"</a></em>"+com.commentContent+"</dd>";
				html+="<dd class='comment_reply'><span>"+com.commentTime+"</span><a href='javascript:void(0);' onclick=\"reply_comment("+answerId+", '"+com.commentId+"')\"> 回复</a></dd>";
				html+="</dl>";
			}
			$this.parent("#answer_"+answerId+"_comment_box_con").removeAttr("style");
//			$("#answer_"+answerId+"_comment_form").after(html);
			$this.append(html);
			var height=$this.outerHeight(true);
			if(list.length>0){
//				$this.parent(".comment_box_con").height(parseInt(53+list.length*49+40));
				$this.parent().parent("#answer_"+answerId+"_comments").show();
				$this.parent().parent("#answer_"+answerId+"_comments").removeAttr("style");
			}
		});
	});
}
//<dl id="answer_comment_22">
//<dt>
//  <a href="http://my.csdn.net/mansuifengqi" target="_blanl">
//      <img alt="mansuifengqi" src="http://avatar.csdn.net/0/E/7/3_mansuifengqi.jpg" style="width:30px; height:30px;" username="mansuifengqi" />
//</a>  
//</dt>
//<dd class="comment_content">
//  <em><a class="user_name" href="http://my.csdn.net/mansuifengqi" target="_blanlk">mansuifengqi</a></em>
//  我认为这个答案要比下边的那个详细很多。还得现翻译英语，这事太困难了。
//</dd>
//<dd class="comment_reply">
//  <span>2 年多之前</span>
//  <a href="javascript:void(0);" onclick="reply_comment(38, '22')"> 回复</a>
//</dd>
//</dl>